
class Permission < ActiveRecord::Base
  validates  :subject_class, :permission_action_id,  presence: true
  has_and_belongs_to_many :admin_users,
                          :class_name => 'Admin::User', join_table: :admin_users_permissions
  resourcify
  validates :subject_class, uniqueness: {scope: [:permission_action_id,:subject_id]}
  #validates :name, uniqueness: true
  belongs_to :permission_action, class_name: 'PermissionAction',
      inverse_of: :permissions

end
